package com.example.androidkt.third

import android.content.Context
import android.content.Intent
import android.os.Bundle
import android.os.PersistableBundle
import androidx.appcompat.app.AppCompatActivity

inline fun <reified T> getGenericType() = T::class.java

fun main() {

    val genericType = getGenericType<String>()
    val genericType1 = getGenericType<Int>()

}

class TestActivity : AppCompatActivity(){
    override fun onCreate(savedInstanceState: Bundle?, persistentState: PersistableBundle?) {
        super.onCreate(savedInstanceState, persistentState)


        startActivity1<TestActivity>(this, block = {
            putExtra("param1","abc")
        })
    }
}

inline fun <reified T> startActivity(context: Context){
    val intent = Intent(context,T::class.java)
    context.startActivity(intent)
}


inline fun <reified T> startActivity1(context: Context,block:Intent.()-> Unit){


    val intent = Intent(context,T::class.java)
    context.startActivity(intent)

}

